package List.LinkedList;

import javax.xml.transform.Source;
import java.util.LinkedList;
import java.util.Scanner;

public class Warehouse {
    public static void main(String[] args) {
        LinkedList<String> products = new LinkedList<>();
        String p1 = new String("Java从入门到精通");
        String p2 = new String("C语言从入门到精通");
        String p3 = new String("Python从入门到精通");
        String p4 = new String("C#从入门到精通");
        products.add(p1);
        products.add(p2);
        products.add(p3);
        products.add(p4);
        String p5 =new String("Spring Boot从入门到精通");
        ((LinkedList<String>)products).addLast(p5);
        System.out.print("**********商品信息**********");
        System.out.println("\n目前商品有：");
        for (int i = 0; i < products.size(); i++) {
            System.out.print(products.get(i)+"\t");
        }
        System.out.println("\n第一个商品名称为："+((LinkedList<String>)products).getFirst());
        System.out.println("最后一个商品名称为："+((LinkedList<String>)products).getLast());
        ((LinkedList<String>)products).removeLast();
        System.out.println("删除最后的元素，目前商品有：");
        for (int i = 0; i < products.size(); i++) {
            System.out.println(products.get(i)+"\t");
        }
    }
}
